{% extends "base.html" %}
{% block title %}Ingresos{% endblock %}
{% block head %}
    {{ super() }}
    
	<script type="text/javascript" src="/assets/js/jquery.js"></script>
  	<script type="text/javascript" src="/assets/js/jquery.validate.js"></script>

 	<script>
		$(document).ready(function() {   
			$("#form1").validate({   
				rules: {income: {required: true,
				                 number: true},   
					    extra_income: {required: true,
					    			   number:true}
				},   
				messages: {income: {required:"Este campo es obligatorio",
						   		    number:"Numero valido"
						   		   },
						   extra_income: {required:"Este campo es obligatorio",
						   		          number:"Numero valido"
						   		         }
						  }   
				}
			);   
		}); 
  </script>
    
{% endblock %}
{% block content %}
	<h1>Ingresos Mensuales</h1>
	<br>
    <form id="form1" action="/month/edit" method="post">
    <input type="hidden" name="id_month" value="{% if month.is_saved() %} {{month.key().id()}} {% else %} -1 {% endif %}" />
    	<table>
      		<tr>
      			<td><label>Nombre</label></td>
      			<td><input type="text" name="name" readonly="readonly" value="{{month.name}}" /></td>
      		</tr>
      		<tr>
      			<td><label>Ingreso*</label></td>
      			<td><input type="text" name="income" value="{{month.income}}" /></td>
      		</tr>
      		<tr>
      			<td><label>Ingreso Extra*</label></td>
      			<td><input type="text" name="extra_income" value="{{month.extra_income}}" /></td>
      		</tr>
      	</table>
      	<br>
        <table>
        	<tr>
        		<td><input name="btnSave" type="submit" value="Guardar" /> </td>
        		<td><input class="cancel" name="btnCancel" type="submit" value="Volver" /></td>
        	</tr>
        </table>
    </form>
    <br>
{% endblock %}
